<template>
	<view class="content">
	    <view class="index-tip">龙殿私人仓库管家，专业守护您的财产</view>
        <myslider :banners="banners" :height="540"/>
           			
			<tabarea @tap="goTo('/pages/delivery/send')">
				<view class="tap-area-slot">
					<text class="title">寄件</text>
					<view class="side-area">
						<view class="triangle-up"></view>
					</view>
				</view>
			</tabarea>
		
		
		
			<tabarea @tap="goTo('/pages/delivery/withdraw')">
				<view class="tap-area-slot">
					 <text class="title">取件</text>
				</view>
			</tabarea>
	
			
	   <Custom-tab-bar :current="0" />
	   
	   <custom-popup ref="customPopup" v-model="isPopupVisible"></custom-popup>
	</view>
</template>

<script>
	
	import customPopup from '../../components/custom-popup.vue';
	import CustomTabBar from '../../components/custom-tab-bar.vue';
	import myslider from '../../components/myslider'
	import tabarea from '../../components/taparea.vue'
	import * as api from '../../utils/api.js'
	
	export default {
		components: { myslider, tabarea, CustomTabBar, customPopup },
		data() {
			return {
				isPopupVisible: true,
				title: '首页',
				banners: [],
				homeInfo: {}
				
			}
		},

		onLoad() {
			this.getHomeInfo();
			uni.hideTabBar({
			    animation: false
			  })
		},
		mounted() {
		   this.showCustomPopup()	
		},
		methods: {
			// 取件，寄件
			goTo(path) {
				// const token = uni.getStorageSync('token');
				// if (!token) {
				// 	uni.redirectTo({
				// 		url: '/pages/login/index'
				// 	});
				// 	return;
				// }
				uni.navigateTo({
					url: path
				})
			},
			async getHomeInfo() {
				const res = await api.getHomeInfo()
				this.homeInfo = res.data || {}
				this.banners = this.homeInfo.homePicture ? this.homeInfo.homePicture.split(',') : [];
				this.title = this.homeInfo.intro;
         uni.setStorageSync('userAgreement', res.data.userAgreement);
			},
			jump() {},
			 showCustomPopup() {
				  this.isPopupVisible = true;
			      const imageSrc = '/static/longdian.png';// 替换为你的图片地址
			      const textContent = '这是一段显示在弹窗中的文字。';
			      this.$refs.customPopup.showPopup(imageSrc, textContent);
			}
		}
	}
</script>

<style lang="scss">
	.content {
		color: white;
		position: relative;
		text-align: center;
		.index-tip {
			font-size: 30rpx;
			padding: 30rpx;
		}
		.intro {
			color: white;
		}

			
		.myslider {
			margin-top: 60rpx;
		}
        .tap-area {
			margin: 20rpx 16rpx;
			.tap-area-slot {
				padding: 10rpx;
				.title {
					font-size: 60rpx;
					letter-spacing: 20rpx;
					color: white;
				}

			}
		}
		


	}
</style>